package com.polaris.live.im.db.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.polaris.live.im.db.entity.GreetMessageEntity

/**
 * 打招呼消息
 *
 * @author Created by 半仙 on 2024/4/26/026 20:56
 */
@Dao
interface GreetMessageEntityDao {
    //插入消息
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun saveMessage(messageEntity: GreetMessageEntity): Long

    //查询是否有这条消息
    @Query("select * from greet_message where user_id = :userId and other_id = :otherId limit 1")
    suspend fun findMessageByUserIdAndMsgId(userId: Long, otherId: Long): GreetMessageEntity?
}